package com.ruoyi.client.pojo.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@ApiModel(value = "购物车更新表单", description = "更新购物车项数量/勾选状态的请求参数")
public class CartUpdateForm {

    @NotNull(message = "购物车记录ID不能为空")
    @ApiModelProperty(value = "购物车记录ID", required = true, example = "1")
    private Long id;

    @Min(value = 1, message = "商品数量必须大于0")
    @ApiModelProperty(value = "商品数量（1-999，可选）", example = "3")
    private Long count; // 修复：数量类型改为Integer，与Service、Mapper层一致

    @NotNull(message = "勾选状态不能为空") // 新增：确保状态参数必传
    @Pattern(regexp = "^[01]$", message = "勾选状态只能是0（未勾选）或1（已勾选）")
    @ApiModelProperty(value = "勾选状态（0=未勾选，1=已勾选，必填）", required = true, example = "1")
    private Integer isChecked; // 修复：补充@NotNull校验，明确参数必填
}